/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.fallback.trade;


import com.enation.app.javashop.core.client.feignimpl.trade.OrderMetaClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import com.enation.app.javashop.model.promotion.fulldiscount.dos.FullDiscountGiftDO;
import com.enation.app.javashop.model.trade.order.dos.OrderMetaDO;
import com.enation.app.javashop.model.trade.order.enums.OrderMetaKeyEnum;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 订单meta熔断
 *
 * @author zh
 * @version v7.0
 * @date 18/9/27 下午3:15
 * @since v7.0
 */
@Component
public class OrderMetaClientFallbackFactory extends BaseFallbackFactory<OrderMetaClientFeignImpl> implements FallbackFactory {

    @Override
    protected OrderMetaClientFeignImpl fallback() {
        return new OrderMetaClientFallback();
    }

    /**
     * 订单meta熔断
     *
     * @author zh
     * @version v7.0
     * @date 18/9/27 下午3:15
     * @since v7.0
     */
    @Component
    public static class OrderMetaClientFallback implements OrderMetaClientFeignImpl {

        protected final Log logger = LogFactory.getLog(this.getClass());

        @Override
        public void add(OrderMetaDO orderMetaDO) {
            logger.error("添加OrderMeta异常");
        }

        @Override
        public List<FullDiscountGiftDO> getGiftList(String orderSn, String status) {
            logger.error("获取订单赠品信息集合异常");
            return null;
        }

        @Override
        public void updateMetaStatus(String orderSn, OrderMetaKeyEnum metaKey, String status) {
            logger.error("修改订单元信息状态异常");
        }

        @Override
        public String getMetaValue(String orderSn, OrderMetaKeyEnum metaKey) {
            logger.error("读取订单元信息异常");
            return null;
        }
    }
}
